#include <iostream>
#include <cmath>
using namespace std;
class Solution {
public:
    int mySqrt(int x) {
        int low = 0;
        int high = x;
        int res = -1;
        while(low <= high){
            int mid = (low + high) / 2;
            if((long long)mid * mid <= x) 
            {
                res = mid;
                low = mid + 1;
            }
            else high = mid - 1;
        }
        return res;
    }
};
int main()
{
    Solution sol;
    cout << sol.mySqrt(100) << endl;
    return 0;
}
